package com.bitoon.basketdudes.jpa;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;

@Entity
@Table(name = "usuario", schema="central")

@NamedQueries({
    @NamedQuery(name = "Usuario.findByNickPassword" , query = "SELECT u FROM Usuario u WHERE u.nick = :nick AND u.password = :password"),
    @NamedQuery(name = "Usuario.findById"           , query = "SELECT u FROM Usuario u WHERE u.id = :id"),
    @NamedQuery(name = "Usuario.findByNick"         , query = "SELECT u FROM Usuario u WHERE u.nick = :nick")
})

public class Usuario implements Serializable {
    private static long serialVersionUID = 1L;

    @Id
    @SequenceGenerator(name="usuario_id_generator", sequenceName="usuario_id_seq",allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="usuario_id_generator")
    private Integer id;

    private String nick;

    @Column(name="nick_mostrar")
    private String  nickMostrar;
    private String  email;
    private String  password;
    private Integer puntos;
    private float   creditos;

    @Column(name = "f_alta")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fAlta;

    @Column(name="f_admision")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fAdmision;

    @Column(name="f_ultimo")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fUltimo;

    @Column(name="f_eula")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fEula;

    private Integer status;

    private Integer genero;

    @Column(name="perfil")
    private Integer admin;

    @Column(name="f_nacim")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fNacimiento;
    
    //bi-directional many-to-one association to Pais
    @ManyToOne
    @JoinColumn(name="pais_id")
    private Pais pais;

    private Integer robinson;

    @Column(name="idioma_id")
    private String idiomaId;

    private int reputacion;
    private int origen_id;
    
    
    @JoinColumn(name="region_id", referencedColumnName = "id")
    @ManyToOne
    private Region region;

    
    public Usuario() {
        
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getNickMostrar() {
        return nickMostrar;
    }

    public void setNickMostrar(String nickMostrar) {
        this.nickMostrar = nickMostrar;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getPuntos() {
        return puntos;
    }

    public void setPuntos(Integer puntos) {
        this.puntos = puntos;
    }

    public float getCreditos() {
        return creditos;
    }

    public void setCreditos(float creditos) {
        this.creditos = creditos;
    }

    public Date getfAlta() {
        return fAlta;
    }

    public void setfAlta(Date fAlta) {
        this.fAlta = fAlta;
    }

    public Date getfAdmision() {
        return fAdmision;
    }

    public void setfAdmision(Date fAdmision) {
        this.fAdmision = fAdmision;
    }

    public Date getfUltimo() {
        return fUltimo;
    }

    public void setfUltimo(Date fUltimo) {
        this.fUltimo = fUltimo;
    }

    public Date getfEula() {
        return fEula;
    }

    public void setfEula(Date valor) {
        this.fEula = valor;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getGenero() {
        return genero;
    }

    public void setGenero(Integer genero) {
        this.genero = genero;
    }

    public Date getfNacimiento() {
        return fNacimiento;
    }

    public void setfNacimiento(Date fNacimiento) {
        this.fNacimiento = fNacimiento;
    }

    public Pais getPais() {
        return pais;
    }

    public void setPais(Pais pais) {
        this.pais = pais;
    }

    public Integer getRobinson() {
        return robinson;
    }

    public void setRobinson(Integer robinson) {
        this.robinson = robinson;
    }

   public Integer getAdmin() {
        return admin;
    }

    public void setAdmin(Integer admin) {
        this.admin = admin;
    }


    public String getIdiomaId() {
        return idiomaId;
    }

    public void setIdiomaId(String idiomaId) {
        this.idiomaId = idiomaId;
    }

    public Integer getReputacion() {
        return reputacion;
    }

    public void setReputacion(Integer valor) {
        if ( valor>99 ){
            this.reputacion=99;
            return;
        }
        if ( valor< 0 ) {
            this.reputacion=0;
            return;
        }
        this.reputacion = valor;
    }

   public Integer getOrigenId() {
        return origen_id;
    }

    public void setOrigenId(Integer valor) {
        this.origen_id = valor;
    }

   public Region getRegion() {
        return region;
    }

    public void setRegion(Region valor) {
        this.region = valor;
    }

}